import { useTableContext } from '@/contexts/TableContext'
import { Button, Form, Input } from 'antd'
import React from 'react'
const QueryForm: React.FC = () => {
  const { queryList, onReset } = useTableContext()
  const [form] = Form.useForm()

  function queryHandler(values: any) {
    console.log('queryHandler', values)
    queryList(values.receiverName)
  }
  const onResetHandler = () => {
    form.resetFields()
    onReset()
  }
  return (
    <Form layout="inline" form={form} onFinish={queryHandler}>
      <Form.Item label="通知人" name="receiverName">
        <Input placeholder="请输入通知人" />
      </Form.Item>
      <Form.Item>
        <Button type="primary" className="mr-[10px]" htmlType="submit">
          查询
        </Button>
        <Button onClick={onResetHandler}>重置</Button>
      </Form.Item>
    </Form>
  )
}
export default QueryForm
